<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="insn.css"/><meta name="generator" content="iform.xsl"/><title>BTI -- A64</title></head><body><table style="margin: 0 auto;"><tr><td><div class="topbar"><a href="index.html">Base Instructions</a></div></td><td><div class="topbar"><a href="fpsimdindex.html">SIMD&amp;FP Instructions</a></div></td><td><div class="topbar"><a href="sveindex.html">SVE Instructions</a></div></td><td><div class="topbar"><a href="mortlachindex.html">SME Instructions</a></div></td><td><div class="topbar"><a href="encodingindex.html">Index by Encoding</a></div></td><td><div class="topbar"><a href="shared_pseudocode.html">Shared Pseudocode</a></div></td><td><div class="topbar"><a href="notice.html">Proprietary Notice</a></div></td></tr></table><hr/><h2 class="instruction-section">BTI</h2>
      <p class="aml">Branch Target Identification. A <span class="asm-code">BTI</span> instruction is used to guard against the execution of instructions which are not the intended target of a branch.</p>
      <p class="aml">Outside of a guarded memory region, a <span class="asm-code">BTI</span> instruction executes as a <span class="asm-code">NOP</span>. Within a guarded memory region while <a class="armarm-xref" title="Reference to Armv8 ARM section">PSTATE</a>.BTYPE != 0b00, a <span class="asm-code">BTI</span> instruction compatible with the current value of PSTATE.BTYPE will not generate a Branch Target Exception and will allow execution of subsequent instructions within the memory region.</p>
      <p class="aml">The operand &lt;targets&gt; passed to a <span class="asm-code">BTI</span> instruction determines the values of <a class="armarm-xref" title="Reference to Armv8 ARM section">PSTATE</a>.BTYPE which the <span class="asm-code">BTI</span> instruction is compatible with.</p>
      <div class="note"><hr class="note"/><h4>Note</h4>
        <p class="aml">Within a guarded memory region, when <a class="armarm-xref" title="Reference to Armv8 ARM section">PSTATE</a>.BTYPE != 0b00, all instructions will generate a Branch Target Exception, other than <span class="asm-code">BRK</span>, <span class="asm-code">BTI</span>, <span class="asm-code">HLT</span>, <span class="asm-code">PACIASP</span>, and <span class="asm-code">PACIBSP</span>, which might not. See the individual instructions for more information.</p>
      <hr class="note"/></div>
    
    <h3 class="classheading"><a id="iclass_system"/>System<span style="font-size:smaller;"><br/>(FEAT_BTI)
          </span></h3><p class="desc"/><div class="regdiagram-32"><table class="regdiagram"><thead><tr><td>31</td><td>30</td><td>29</td><td>28</td><td>27</td><td>26</td><td>25</td><td>24</td><td>23</td><td>22</td><td>21</td><td>20</td><td>19</td><td>18</td><td>17</td><td>16</td><td>15</td><td>14</td><td>13</td><td>12</td><td>11</td><td>10</td><td>9</td><td>8</td><td>7</td><td>6</td><td>5</td><td>4</td><td>3</td><td>2</td><td>1</td><td>0</td></tr></thead><tbody><tr class="firstrow"><td class="l">1</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td class="r">0</td><td class="lr">0</td><td class="l">0</td><td class="r">0</td><td class="l">0</td><td>1</td><td class="r">1</td><td class="l">0</td><td>0</td><td>1</td><td class="r">0</td><td class="l">0</td><td>1</td><td>0</td><td class="r">0</td><td class="l">x</td><td>x</td><td class="r">0</td><td class="l">1</td><td>1</td><td>1</td><td>1</td><td class="r">1</td></tr><tr class="secondrow"><td colspan="10"/><td/><td colspan="2"/><td colspan="3"/><td colspan="4"/><td colspan="4" class="droppedname">CRm</td><td colspan="3" class="droppedname">op2</td><td colspan="5"/></tr></tbody></table></div><div class="encoding"><h4 class="encoding"/><a id="BTI_HB_hints"/><p class="asm-code">BTI  {<a href="#sa_targets" title="Type of indirection (field &quot;op2&lt;2:1&gt;&quot;) [(omitted),c,j,jc]">&lt;targets&gt;</a>}</p></div><p class="pseudocode"><a href="shared_pseudocode.html#SystemHintOp" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp</a> op;

if CRm:op2 == '0100 xx0' then
    op = <a href="shared_pseudocode.html#SystemHintOp_BTI" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp_BTI</a>;
    // Check branch target compatibility between BTI instruction and PSTATE.BTYPE
    <a href="shared_pseudocode.html#impl-aarch64.SetBTypeCompatible.1" title="function: SetBTypeCompatible(boolean x)">SetBTypeCompatible</a>(<a href="shared_pseudocode.html#impl-aarch64.BTypeCompatible_BTI.1" title="function: boolean BTypeCompatible_BTI(bits(2) hintcode)">BTypeCompatible_BTI</a>(op2&lt;2:1&gt;));
else
    <a href="shared_pseudocode.html#impl-shared.EndOfInstruction.0" title="function: EndOfInstruction()">EndOfInstruction</a>();</p>
  <div class="encoding-notes"/><h3 class="explanations">Assembler Symbols</h3><div class="explanations"><table><col class="asyn-l"/><col class="asyn-r"/><tr><td>&lt;targets&gt;</td><td><a id="sa_targets"/>
        <p>Is the type of indirection, 
      encoded in
      <q>op2&lt;2:1&gt;</q>:
        </p>
        <table class="valuetable">
          
            <thead>
              <tr>
                <th class="bitfield">op2&lt;2:1&gt;</th>
                <th class="symbol">&lt;targets&gt;</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td class="bitfield">00</td>
                <td class="symbol">(omitted)</td>
              </tr>
              <tr>
                <td class="bitfield">01</td>
                <td class="symbol">c</td>
              </tr>
              <tr>
                <td class="bitfield">10</td>
                <td class="symbol">j</td>
              </tr>
              <tr>
                <td class="bitfield">11</td>
                <td class="symbol">jc</td>
              </tr>
            </tbody>
          
        </table>
      </td></tr></table></div><div class="syntax-notes"/>
    <div class="ps"><a id="execute"/><h3 class="pseudocode">Operation</h3>
      <p class="pseudocode">case op of
    when <a href="shared_pseudocode.html#SystemHintOp_YIELD" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp_YIELD</a>
        <a href="shared_pseudocode.html#impl-shared.Hint_Yield.0" title="function: Hint_Yield()">Hint_Yield</a>();

    when <a href="shared_pseudocode.html#SystemHintOp_DGH" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp_DGH</a>
        <a href="shared_pseudocode.html#impl-shared.Hint_DGH.0" title="function: Hint_DGH()">Hint_DGH</a>();

    when <a href="shared_pseudocode.html#SystemHintOp_WFE" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp_WFE</a>
        integer localtimeout = 1 &lt;&lt; 64;    // No local timeout event is generated
        <a href="shared_pseudocode.html#impl-shared.Hint_WFE.2" title="function: Hint_WFE(integer localtimeout, WFxType wfxtype)">Hint_WFE</a>(localtimeout, <a href="shared_pseudocode.html#WFxType_WFE" title="enumeration WFxType {WFxType_WFE, WFxType_WFI, WFxType_WFET, WFxType_WFIT}">WFxType_WFE</a>);

    when <a href="shared_pseudocode.html#SystemHintOp_WFI" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp_WFI</a>
        integer localtimeout = 1 &lt;&lt; 64;    // No local timeout event is generated
        <a href="shared_pseudocode.html#impl-shared.Hint_WFI.2" title="function: Hint_WFI(integer localtimeout, WFxType wfxtype)">Hint_WFI</a>(localtimeout, <a href="shared_pseudocode.html#WFxType_WFI" title="enumeration WFxType {WFxType_WFE, WFxType_WFI, WFxType_WFET, WFxType_WFIT}">WFxType_WFI</a>);

    when <a href="shared_pseudocode.html#SystemHintOp_SEV" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp_SEV</a>
        <a href="shared_pseudocode.html#impl-shared.SendEvent.0" title="function: SendEvent()">SendEvent</a>();

    when <a href="shared_pseudocode.html#SystemHintOp_SEVL" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp_SEVL</a>
        <a href="shared_pseudocode.html#impl-shared.SendEventLocal.0" title="function: SendEventLocal()">SendEventLocal</a>();

    when <a href="shared_pseudocode.html#SystemHintOp_ESB" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp_ESB</a>
        if <a href="shared_pseudocode.html#impl-shared.HaveTME.0" title="function: boolean HaveTME()">HaveTME</a>() &amp;&amp; TSTATE.depth &gt; 0 then
            <a href="shared_pseudocode.html#impl-aarch64.FailTransaction.2" title="function: FailTransaction(TMFailure cause, boolean retry)">FailTransaction</a>(<a href="shared_pseudocode.html#TMFailure_ERR" title="enumeration TMFailure { TMFailure_CNCL, TMFailure_DBG, TMFailure_ERR, TMFailure_NEST, TMFailure_SIZE, TMFailure_MEM, TMFailure_TRIVIAL, TMFailure_IMP }">TMFailure_ERR</a>, FALSE);
        <a href="shared_pseudocode.html#impl-shared.SynchronizeErrors.0" title="function: SynchronizeErrors()">SynchronizeErrors</a>();
        <a href="shared_pseudocode.html#AArch64.ESBOperation.0" title="function: AArch64.ESBOperation()">AArch64.ESBOperation</a>();
        if PSTATE.EL IN {<a href="shared_pseudocode.html#EL0" title="constant bits(2) EL0 = '00'">EL0</a>, <a href="shared_pseudocode.html#EL1" title="constant bits(2) EL1 = '01'">EL1</a>} &amp;&amp; <a href="shared_pseudocode.html#impl-shared.EL2Enabled.0" title="function: boolean EL2Enabled()">EL2Enabled</a>() then <a href="shared_pseudocode.html#AArch64.vESBOperation.0" title="function: AArch64.vESBOperation()">AArch64.vESBOperation</a>();
        <a href="shared_pseudocode.html#impl-shared.TakeUnmaskedSErrorInterrupts.0" title="function: TakeUnmaskedSErrorInterrupts()">TakeUnmaskedSErrorInterrupts</a>();

    when <a href="shared_pseudocode.html#SystemHintOp_PSB" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp_PSB</a>
        <a href="shared_pseudocode.html#impl-aarch64.ProfilingSynchronizationBarrier.0" title="function: ProfilingSynchronizationBarrier()">ProfilingSynchronizationBarrier</a>();

    when <a href="shared_pseudocode.html#SystemHintOp_TSB" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp_TSB</a>
        <a href="shared_pseudocode.html#impl-shared.TraceSynchronizationBarrier.0" title="function: TraceSynchronizationBarrier()">TraceSynchronizationBarrier</a>();

    when <a href="shared_pseudocode.html#SystemHintOp_GCSB" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp_GCSB</a>
        <a href="shared_pseudocode.html#impl-aarch64.GCSSynchronizationBarrier.0" title="function: GCSSynchronizationBarrier()">GCSSynchronizationBarrier</a>();

    when <a href="shared_pseudocode.html#SystemHintOp_CHKFEAT" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp_CHKFEAT</a>
        <a href="shared_pseudocode.html#impl-aarch64.X.write.2" title="accessor: X[integer n, integer width] = bits(width) value">X</a>[16, 64] = <a href="shared_pseudocode.html#AArch64.ChkFeat.1" title="function: bits(64) AArch64.ChkFeat(bits(64) feat_select)">AArch64.ChkFeat</a>(<a href="shared_pseudocode.html#impl-aarch64.X.read.2" title="accessor: bits(width) X[integer n, integer width]">X</a>[16, 64]);

    when <a href="shared_pseudocode.html#SystemHintOp_CSDB" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp_CSDB</a>
        <a href="shared_pseudocode.html#impl-shared.ConsumptionOfSpeculativeDataBarrier.0" title="function: ConsumptionOfSpeculativeDataBarrier()">ConsumptionOfSpeculativeDataBarrier</a>();

    when <a href="shared_pseudocode.html#SystemHintOp_CLRBHB" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp_CLRBHB</a>
        <a href="shared_pseudocode.html#impl-shared.Hint_CLRBHB.0" title="function: Hint_CLRBHB()">Hint_CLRBHB</a>();

    when <a href="shared_pseudocode.html#SystemHintOp_BTI" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp_BTI</a>
        <a href="shared_pseudocode.html#impl-aarch64.SetBTypeNext.1" title="function: SetBTypeNext(bits(2) x)">SetBTypeNext</a>('00');

    when <a href="shared_pseudocode.html#SystemHintOp_NOP" title="enumeration SystemHintOp { SystemHintOp_NOP, SystemHintOp_YIELD, SystemHintOp_WFE, SystemHintOp_WFI, SystemHintOp_SEV, SystemHintOp_SEVL, SystemHintOp_DGH, SystemHintOp_ESB, SystemHintOp_PSB, SystemHintOp_TSB, SystemHintOp_BTI, SystemHintOp_WFET, SystemHintOp_WFIT, SystemHintOp_CLRBHB, SystemHintOp_GCSB, SystemHintOp_CHKFEAT, SystemHintOp_CSDB }">SystemHintOp_NOP</a>
        return;    // do nothing

    otherwise
        <a href="shared_pseudocode.html#impl-shared.Unreachable.0" title="function: Unreachable()">Unreachable</a>();</p>
    </div>
  <hr/><table style="margin: 0 auto;"><tr><td><div class="topbar"><a href="index.html">Base Instructions</a></div></td><td><div class="topbar"><a href="fpsimdindex.html">SIMD&amp;FP Instructions</a></div></td><td><div class="topbar"><a href="sveindex.html">SVE Instructions</a></div></td><td><div class="topbar"><a href="mortlachindex.html">SME Instructions</a></div></td><td><div class="topbar"><a href="encodingindex.html">Index by Encoding</a></div></td><td><div class="topbar"><a href="shared_pseudocode.html">Shared Pseudocode</a></div></td><td><div class="topbar"><a href="notice.html">Proprietary Notice</a></div></td></tr></table><p class="versions">
      Internal version only: isa v33.62, AdvSIMD v29.12, pseudocode v2023-03_rel, sve v2023-03_rc3b
      ; Build timestamp: 2023-03-31T11:36
    </p><p class="copyconf">
      Copyright © 2010-2023 Arm Limited or its affiliates. All rights reserved.
      This document is Non-Confidential.
    </p></body></html>
